package airport.server.service;

import airport.server.DAO.HotelDAO;
import airport.shared.beans.HotelBean;
import airport.shared.service.HotelService;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;

import java.util.ArrayList;

/**
 * Created by François on 06/03/2015.
 */
public class HotelServiceImpl extends RemoteServiceServlet implements HotelService {

	@Override
	public ArrayList<HotelBean> selectAll() {
		HotelDAO hDAO = new HotelDAO();

		return hDAO.selectAll();
	}

	@Override
	public String save(String nom, String adresse, int standing, Float tarif) {
		HotelDAO hDAO = new HotelDAO();

		HotelBean hotelBean = new HotelBean();
		hotelBean.setNom(nom);
		hotelBean.setAdresse(adresse);
		hotelBean.setStanding(standing);
		hotelBean.setTarif(tarif);

		return hDAO.save(hotelBean);
	}

	@Override
	public String update(HotelBean hotel) {
		HotelDAO hDAO = new HotelDAO();

		return hDAO.update(hotel);
	}

	@Override
	public String delete(HotelBean hotel) {
		HotelDAO hDAO = new HotelDAO();

        return hDAO.delete(hotel);
    }
}
